package com.xiaozhu.pojo.result;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author 朱慧军
 * @version 1.0
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Result<T>{

    private Integer code; // 1 成功 0 失败
    private String meg;
    private T data;


    public static <T> Result<T> success(){
        Result<T> result = new Result<>();
        result.setCode(1);

        return result;

    }

    public static <T> Result<T> success(T data){
        Result<T> tResult = new Result<>();
        tResult.setCode(1);
        tResult.setData(data);
        return tResult;

    }

    public static <T> Result<T> error(){
        Result<T> result = new Result<>();
        result.setCode(0);

        return result;

    }




}
